package com.example.neusoft.ui_demo.recyclerview;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.neusoft.ui_demo.R;
import com.example.neusoft.ui_demo.beans.Shop;
import com.example.neusoft.ui_demo.retrofitservice.RetrofitService;
import com.google.gson.Gson;
import com.squareup.picasso.Picasso;

import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;

public class RecyclerViewActivity extends AppCompatActivity {
    private ImageView imageView;
    private TextView textView1;
    private String str="-";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recycler_view);
        imageView = findViewById(R.id.imageView2);
        textView1 = findViewById(R.id.textView1);

        RecyclerViewAdapter adapter = new RecyclerViewAdapter();
        adapter.setDate(getData());
        RecyclerView recyclerView = findViewById(R.id.recyclerView);
        LinearLayoutManager layoutManager =
                new LinearLayoutManager(RecyclerViewActivity.this);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setAdapter(adapter);
        recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
//        load();

    }

    private List<DataItem> getData() {
        List<DataItem> data = new ArrayList<>();
        for (int i = 0; i < 5; ++i) {
            DataItem dataItem = new DataItem();
//            String s=load(i);
//            System.out.println("*************"+s+"*********");
            dataItem.setUrl("image" + i);
            dataItem.setText1("text1:" + i);
            dataItem.setText2("text2:" + i);
            data.add(dataItem);
        }
        return data;
    }






}

